﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Having.Site.MessageQueue
{
    /// <summary>
    /// 获取信息
    /// </summary>
    public static class MQHelper
    {
        static readonly object IClock = new object();
        static Dictionary<MQConfig, IMessageQueue> dic = new Dictionary<MQConfig, IMessageQueue>();
        
        /// <summary>
        /// 获得链接
        /// </summary>
        /// <param name="mc"></param>
        /// <param name="_etype">链接方式</param>
        /// <returns></returns>
        public static IMessageQueue GetMQHelp(MQConfig mc, ExchangeType _etype = ExchangeType.fanout)
        {
            IMessageQueue _IDataCacheHelper = null;
            switch (mc.MQName)
            {
                case "RabbitMQ":
                    _IDataCacheHelper = new RabbitMessageQueue(mc, _etype);
                    dic.Add(mc, _IDataCacheHelper);
                    break;

            }
            return _IDataCacheHelper;
        }
    

    }
}
